from appium.webdriver.common.appiumby import By

from page.page01_index import app_index, search_index
from page.page02_login import app_login
from tools import app_driver, driver_quit


def app_index_success():
    driver = app_driver()
    app_index(driver)
    app_login(driver, "14000000000", "123456")
    search_word = "小米8"
    search_index(driver, search_word)
    information = driver.find_element(by=By.ID, value="com.tpshop.malls:id/sort_composite_tv").text
    assert "综合" == information
    driver_quit(driver)

if __name__ == '__main__':
    app_index_success()